import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface GetAtomicMetricsBaseList_ {
  /**
   * @description 搜索关键词
   */
  content?: string;
  /**
   * @description 指标类型
   */
  metricsType?: "ATOMIC" | "DERIVED" | "LOGIC" | "INTERMEDIATE_DERIVED";
  /**
   * @description 页数
   * @format int32
   */
  pageNum?: number;
  /**
   * @description 条数
   * @format int32
   */
  pageSize?: number;
  /**
   * @description 主题id
   * @format int32
   */
  subjectId?: number;
}
export interface DeleteAtomicMetricsBatchDelete_ {
  /**
   * @description ids
   */
  ids: number[];
}
export interface GetAtomicMetricsHintSimpleList_ {
  /**
   * @description 模糊名称
   */
  content?: string;
  /**
   * @description 基础,衍生类型
   * @format int32
   */
  subType?: number;
  /**
   * @description 主题id
   * @format int32
   */
  subjectId?: number;
}
export interface GetAtomicMetricsList_ {
  /**
   * @description 业务负责人
   */
  businessOwner?: string;
  /**
   * @description 搜索条件
   */
  content?: string;
  /**
   * @description 创建人
   */
  createBy?: string;
  /**
   * @description 部门id
   * @format int32
   */
  departmentId?: number;
  /**
   * @description 我的创建标识
   */
  myCreate?: boolean;
  /**
   * @description 排序顺序,可选的值1:asc:、2:desc，默认2
   * @format int32
   */
  order?: number;
  /**
   * @description 页数
   * @format int32
   */
  pageNum?: number;
  /**
   * @description 条数
   * @format int32
   */
  pageSize?: number;
  /**
   * @description 指标审核状态
   */
  reviewStatus?: string;
  /**
   * @description 排序条件,可选的值cnName、id、createBy、reviewStatus,subType
   */
  sortBy?: string;
  /**
   * @description 基础/衍生类型
   * @format int32
   */
  subType?: number;
  /**
   * @description 主题id
   * @format int32
   */
  subjectId?: number;
  /**
   * @description 技术负责人
   */
  techOwner?: string;
}
export interface GetAtomicMetricsById_ {
  /**
   * @description 原子指标id
   */
  id: number;
}
export interface PutAtomicMetricsById_ {
  /**
   * @description id
   */
  id: number;
}
export interface DeleteAtomicMetricsById_ {
  /**
   * @description 原子指标id
   */
  id: number;
}

export class AtomicMetrics {
  /**
   * 新增原子指标
   *
   * @tags 原子指标模块controller
   * @request POST: /atomic-metrics
   * @secure
   */
  postAtomicMetrics = (metricDTO: defs.MetricsDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityMetricsVO>({
      url: `/atomic-metrics`,
      method: "POST",
      data: metricDTO,
      ...params,
    });

  /**
   * 获取基础指标的基本信息
   *
   * @tags 原子指标模块controller
   * @request GET: /atomic-metrics/base-list
   * @secure
   */
  getAtomicMetricsBaseList = (
    query:
      | {
          content?: string;
          metricsType?: "ATOMIC" | "DERIVED" | "LOGIC" | "INTERMEDIATE_DERIVED";
          pageNum?: number;
          pageSize?: number;
          subjectId?: number;
        }
      | GetAtomicMetricsBaseList_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityPageInfoMetricsVO>({
      url: `/atomic-metrics/base-list`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 批量删除原子指标
   *
   * @tags 原子指标模块controller
   * @request DELETE: /atomic-metrics/batch-delete
   * @secure
   */
  deleteAtomicMetricsBatchDelete = (
    query: { ids: number[] } | DeleteAtomicMetricsBatchDelete_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntity>({
      url: `/atomic-metrics/batch-delete`,
      method: "DELETE",
      params: query,
      ...params,
    });

  /**
   * 获取指标运算逻辑聚合方式
   *
   * @tags 原子指标模块controller
   * @request GET: /atomic-metrics/combine-enum
   * @secure
   */
  getAtomicMetricsCombineEnum = (params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListOptionVO>({
      url: `/atomic-metrics/combine-enum`,
      method: "GET",
      ...params,
    });

  /**
   * 模糊获取已发布状态的原子指标列表
   *
   * @tags 原子指标模块controller
   * @request GET: /atomic-metrics/hint-simple-list
   * @secure
   */
  getAtomicMetricsHintSimpleList = (
    query: { content?: string; subType?: number; subjectId?: number } | GetAtomicMetricsHintSimpleList_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityListSimpleMetricsVO>({
      url: `/atomic-metrics/hint-simple-list`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 原子指标列表
   *
   * @tags 原子指标模块controller
   * @request GET: /atomic-metrics/list
   * @deprecated
   * @secure
   */
  getAtomicMetricsList = (
    query:
      | {
          businessOwner?: string;
          content?: string;
          createBy?: string;
          departmentId?: number;
          myCreate?: boolean;
          order?: number;
          pageNum?: number;
          pageSize?: number;
          reviewStatus?: string;
          sortBy?: string;
          subType?: number;
          subjectId?: number;
          techOwner?: string;
        }
      | GetAtomicMetricsList_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityPageInfoMetricsVO>({
      url: `/atomic-metrics/list`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 获取原子指标详情
   *
   * @tags 原子指标模块controller
   * @request GET: /atomic-metrics/{id}
   * @secure
   */
  getAtomicMetricsById = ({ id }: { id: number } | GetAtomicMetricsById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityMetricsVO>({
      url: `/atomic-metrics/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 修改原子指标信息
   *
   * @tags 原子指标模块controller
   * @request PUT: /atomic-metrics/{id}
   * @secure
   */
  putAtomicMetricsById = (
    { id }: { id: number } | PutAtomicMetricsById_,
    body: defs.MetricsDTO,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityMetricsVO>({
      url: `/atomic-metrics/${id}`,
      method: "PUT",
      data: body,
      ...params,
    });

  /**
   * 删除原子指标
   *
   * @tags 原子指标模块controller
   * @request DELETE: /atomic-metrics/{id}
   * @deprecated
   * @secure
   */
  deleteAtomicMetricsById = ({ id }: { id: number } | DeleteAtomicMetricsById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityMetricsVO>({
      url: `/atomic-metrics/${id}`,
      method: "DELETE",
      ...params,
    });
}

export default new AtomicMetrics();
